package com.sinoatma.physignsmonitor.bean

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query

@Dao
interface MonitorRecordDao {

    // 插入一条记录
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(record: MonitorRecordEntity)

    // 分页查询，返回每页20条数据
    @Query("SELECT * FROM monitor_records ORDER BY dateStr DESC LIMIT :limit OFFSET :offset")
    suspend fun getRecordsByPage(limit: Int, offset: Int): List<MonitorRecordEntity>
}
